<?php
//define default permisson
if(!defined('NEED_PERMISSION'))
{
	 define('NEED_PERMISSION','ADMIN');
}
/**** check permission begin ********/
	if(defined('NEED_PERMISSION'))
	{
		$allowAccess = false;
		$needPermission = constant('NEED_PERMISSION');
		switch($needPermission)
		{
			case 'ADMIN':
				if(SessionUtil::isExistVar(constant('SESSION_KEY_ADMIN_ID')))
				{
					$allowAccess = true;
				}
			break;
			case 'NONEEDLOGIN':
				$allowAccess = true;
			break;
		}
		if($allowAccess !== true)
		{
			ob_clean();
			header('Location:login.php');
			exit();
		}
	}else{
		exit('Not Completed page');
	}
/**** check permission end ********/
?>